package org.jeecg.client.config;

import org.jeecg.tool.MyLicenseVerifier;
import de.schlichtherle.license.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @Author jeecg
 * @Description
 * @Date 2022/6/15 17:41
 */
@Component
@Slf4j
public class LicenseRegister implements ApplicationRunner {

    @Autowired
    private LicenseConfig config;

    @Autowired
    private LicenseManager manager;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("------开始注册证书------");
        new MyLicenseVerifier().install(config.getLicPath(), manager);
        log.info("------结束注册证书------");
    }
}
